package com.itheima.service.impl;

import com.itheima.domain.Trip;
import com.itheima.mapper.TripMapper;
import com.itheima.service.TripService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TripServiceImpl implements TripService {

    @Autowired
    private TripMapper tripMapper;

    public List<Trip> findAllTrip() {

        List<Trip> trips = tripMapper.findAllTrip();
        return trips;
    }

    public int addTrip(Trip trip) {
        int AddResult = tripMapper.addTrip(trip);
        return AddResult;
    }

    public Trip queryTripById(Integer id) {
        Trip trip = tripMapper.queryTripById(id);
        return trip;
    }

    public int updateTripById(Integer id) {
        int updateResult = tripMapper.updateTripById(id);
        return updateResult;
    }

    public int deleteTripById(Long id) {

        int deleteResult = tripMapper.deleteTripById(id);
        return deleteResult;
    }
}
